package com.zhihu_lvliangi_android.option.zhengwu.adapter;

import java.util.List;

import com.android.utils.SelecterUtil;
import com.zhihu_lvliangi_android.R;
import com.zhihu_lvliangi_android.domain.ZhengwuColumnItem;
import com.zhihu_lvliangi_android.domain.ZhengwuDepartColumnItem;
import com.zhihu_lvliangi_android.util.ViewHolder;

import android.content.Context;
import android.renderscript.Element;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;

public class ColumnAnotherGridViewAdapter extends BaseAdapter {
	

	private Context mContext;
	private List<ZhengwuDepartColumnItem> mColumnItems;
	public ColumnAnotherGridViewAdapter(Context context,List<ZhengwuDepartColumnItem> ColumnItems) {
		mContext = context;
		mColumnItems = ColumnItems;
	}
	

	
	public void setColumnItems(List<ZhengwuDepartColumnItem> mColumnItems) {
		this.mColumnItems = mColumnItems;
	}



	@Override
	public int getCount() {
		return mColumnItems.size();
	}

	@Override
	public ZhengwuDepartColumnItem getItem(int position) {
		return mColumnItems.get(position);
	}

	@Override
	public long getItemId(int position) {
		return position;
	}

	@Override
	public View getView(int position, View convertView, ViewGroup parent) {
	
		if (convertView ==null) {
			convertView = LayoutInflater.from(mContext).inflate(R.layout.general_gridview_text_item, null);
		}
		TextView textView = ViewHolder.get(convertView, R.id.general_grid_view_item_txt);
		textView.setSingleLine(false);
		textView.setLines(2);
		textView.setText(mColumnItems.get(position).getGuide_depart_name());
		
		if (position %2 ==1) {
		
			convertView.setBackground(	SelecterUtil.setSelector(mContext, R.color.departitem_item_blue, R.color.white, R.color.base_text_shadow, R.color.base_text_grey));
		}
		return convertView;
	}

}
